#!/bin/bash

ADD_PROXY_ADDR="http://39.100.58.244:5000/addproxy"
DEL_PROXY_ADDR="http://39.100.58.244:5000/deleteproxy"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

change_proxy() {
    . $DIR/pppoe.sh
}

main() {
    echo `date`
    # delete old proxy
    curl --connect-timeout 5 $DEL_PROXY_ADDR
    echo 'changing proxy'

    # change proxy
    change_proxy

    # add new proxy
    curl --connect-timeout 5 $ADD_PROXY_ADDR
    echo "------------------------------------"
}

main
